using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace MicroFractal.iTunesBrowser.Core.Data.ITunesDB.Item
{
    public class AlbumItem : DataItem
    {

        #region Constructors

        public AlbumItem(MemoryStream data)
            : base(data)
        {
            base.Properties = new Dictionary<StringDataTypeEnum, StringData>();
            int len = 0;
            //reader.ReadBytes(reader.BaseStream.Position
            int oldLen = len;
            for (int i = 0; i < base.StringCount; i++)
            {
                oldLen += len;
                len = Helper.ITunesHelper.BytesToInt(data, base.Length + oldLen + 8, 4);
                if (len > 0)
                {
                    StringData d = new StringData(Helper.ITunesHelper.GetMemoryStream(data, base.Length + oldLen, len));
                    base.Properties.Add(d.StringType, d);
                }
            }
        }

        #endregion
    }
}
